<!-- 
 Copyright 2009 University of  Washington
This code is released under the GPL version 3 - with a copy of the license included
@author Maya Hao Li
 -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=ISO-8859-1" language="java"%>
<%@page import="seedpod.webapp.*"%>
<%@page import="seedpod.webapp.controller.FailToAuthenticateException"%>
<%@page import=" seedpod.util.Util"%>
<%@page import="seedpod.model.SeedpodModel" %>


<%@page import="seedpod.webapp.view.Page"%>
<link
	href="<%=Util.getAbsoluteURL(Seedpod.getWebappUrlRoot(), LimsContext.getContextParameter(LimsContext.PARAM_SEEDPOD_STYLESHEET))%>"
	type="text/css" rel="stylesheet">
<script type="text/JavaScript">

  function login() {
  	alert('login');
	new Ajax.Request('<%=Util.getAbsoluteURL(request.getContextPath(), "/authenticator")%>',
		{
  		 method:'get',
  		 parameters: {
  		 	userName: $F('<%=SeedpodModel.RdbSlot.USERNAME %>'),
  		 	password: $F('<%=SeedpodModel.RdbSlot.PASSWORD %>')	 
  		  },
  		 
  		 onSuccess:function(transport) {
  		 	var response = transport.responseText;
  		 	alert(response);
  		 	
			window.location = response;
  	 		},

    	onFailure: function() {
    		alert('something went wrong...'); 
    	}
    	} );
  }

</script>
<%	Page spPage = new Page();
	spPage.addJsLibrary( "/javascript/lib/scriptaculous/src/effects.js"	);
	out.println( spPage.getPageOpenHtml() );
	out.println( spPage.getBanner( null ) );
%>


<div id="container">
<div id="content">
<div class="alertBox" align="center">
<!-- action="Util.getAbsoluteURL(request.getContextPath(), "/authenticator") %>" --> 
<form method="post" id="signInForm"  action="<%=Util.getAbsoluteURL(request.getContextPath(), "/authenticator") %>">
<div class="sectionTitle">Please Sign In</div>

<%LimsSession m_session = LimsSession.getSession(request);   
FailToAuthenticateException authErr = (FailToAuthenticateException)m_session.getAttribute( FailToAuthenticateException.class.getName() );
if (authErr != null ) {
	out.println("<div class=\"errorBox\" id=\"signinErrBox\">");
	out.println(authErr.getMessage() );
	out.println("</div>");
}
%>

<table border=0>
<tr>
	<td class="heading">Lab Database:
	</td>
	<td><input type="text" name="limsSystem" value="Single Unit Recording LIMS" readonly class="readonlyInput" size="30"></td>
</tr>

<tr>
	<td class="requiredHeading">SeedpodID:</td>
	<td><input type="text" name="<%=SeedpodModel.RdbSlot.USERNAME %>" size="30" class="requiredInput" value="administrator"> </td>
</tr>

<tr>
	<td class="requiredHeading">Password:</td>
	<td><input type="password" name="<%=SeedpodModel.RdbSlot.PASSWORD %>" size="30" class="requiredInput" value="seedpod">
	</td>

</table>


<div class="formControl">
	<input type="submit" name="Sign In" id="signInButton" value="Sign in" class="button"></div>
</form>
</div>


</div><!-- end content div -->
</div><!--  end container div -->
<% out.println(spPage.getFooter()); %>
